FROM alpine:3.17

# 安装必要工具
RUN apk add --no-cache bash curl

# 下载crictl
RUN curl -L https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.24.0/crictl-v1.24.0-linux-amd64.tar.gz -o crictl.tar.gz && \
    tar zxvf crictl.tar.gz -C /usr/local/bin && \
    rm -f crictl.tar.gz

# 创建crictl配置目录
RUN mkdir -p /etc/crictl

# 添加crictl配置
RUN echo 'runtime-endpoint: unix:///run/containerd/containerd.sock' > /etc/crictl.yaml

# 添加清理脚本
COPY cleanup-script.sh /usr/local/bin/cleanup-script.sh
RUN chmod +x /usr/local/bin/cleanup-script.sh

# 设置默认命令
CMD ["/usr/local/bin/cleanup-script.sh"] 